<template>
  <div>
    <el-container style="height: 800px; border: 1px solid #eee">
      <el-aside  width="200px" style="background-color: rgb(238, 241, 246)">
        <Aside></Aside>
      </el-aside>
      <el-container>
        <el-header style="text-align: right; font-size: 12px;">
          <Head></Head>
        </el-header>
        <el-main>
          <h1>Dashboard</h1>
          <el-button class="el-button el-button--primary" @click="showSession">Button</el-button>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import Aside from "@/components/Aside";
import Head from "@/components/Head";
import {ElMessage} from "element-plus";

export default {
  name: "Main",

  components: {
    Aside,
    Head
  },
  methods:{
    showSession() {
      // ElMessage.success({
      //   message: sessionStorage.getItem("userInfo").username,
      //   type: 'success'
      // })

      ElMessage.success({
        message: this.$store.getters.getUser,
        type: 'success'
      })
    }
  },
  created() {
    if (this.$store.getters.getUser == null || this.$store.getters.getUser.username == null) {
      this.$router.push('/login')
    }
  }
}
</script>

<style scoped>

.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>
